package com.ddl.armark1;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		//-------------------------Metodo Boton Guiame-------------//
		Button Guiame = (Button) findViewById(R.id.BtnGuiame);
		Guiame.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				Intent VGuiame = new Intent(MainActivity.this, GuiameActivity.class);
				startActivity(VGuiame);
			}});

		//-------------------------Metodo Boton Buscar -------------//
		Button Buscar = (Button) findViewById(R.id.BtnBuscar);
		Buscar.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				Intent VBuscar = new Intent(MainActivity.this, BuscarActivity.class);
				startActivity(VBuscar);				
			}});
		
		//-------------------------Metodo Boton Promociones-------------//
		Button Promociones = (Button) findViewById(R.id.BtnPromociones);
		Promociones.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				Intent VPromociones = new Intent(MainActivity.this, PromocionesActivity.class);
				startActivity(VPromociones);
			}});
		
		//-------------------------Metodo Buscar almacen-------------//
		Button BuscarAlmacen = (Button) findViewById(R.id.BtnBucarAlmacen);
		BuscarAlmacen.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				Intent VBuscarAlmacen = new Intent(MainActivity.this, BuscarAlmacenActivity.class);
				startActivity(VBuscarAlmacen);				
			}});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {		
		super .onCreateOptionsMenu(menu);
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.menu, menu);
		//getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}	
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()){
		case R.id.BtnBuscar:
			Intent VBuscar = new Intent(MainActivity.this, BuscarActivity.class);
			startActivity(VBuscar);	
			break;
		case R.id.BtnBucarAlmacen:
			Intent VBuscarAlmacen = new Intent(MainActivity.this, BuscarAlmacenActivity.class);
			startActivity(VBuscarAlmacen);	
			break;
		case R.id.BtnGuiame:
			Intent VGuiame = new Intent(MainActivity.this, GuiameActivity.class);
			startActivity(VGuiame);
			break;
		case R.id.BtnPromociones:
			Intent VPromociones = new Intent(MainActivity.this, PromocionesActivity.class);
			startActivity(VPromociones);
			break;			
		}
		
		return false;
	}

}
